{#-
    This is the basic layout of our example application.
    It is the core skeleton shared between all pages.
    It expects the struct of any template that `{% extends %}` this layout to contain
    (at least) a field `lang: Lang`, so it can be used in the `<html lang=` attribute.
-#}

<!DOCTYPE html>
<html lang="{{lang}}">
    <head>
        <meta charset="UTF-8" />
        {#-
            A base template can contain `blocks`, which my be overridden templates that use
            this base template. A block may contain a default content, if the extending
            template does want to / need to override the content of a block.

            E.g. maybe you would like to have "Askama example application" as default title for
            your pages, then simply add this text (without quotation marks) in the block!

            The default content can be as complex as you need it to be.
            E.g. it may contain any nodes like `{% if … %}`, and even other blocks.
        ~#}
        <title>{% block title %}{% endblock %}</title>

        <meta http-equiv="expires" content="Sat, 01 Dec 2001 00:00:00 GMT" />
        <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta name="robots" content="noindex, nofollow" />

        {#-
            In a real application you most likely would want to link style sheets,
            any JavaScripts etc. using e.g. `actix-files`, instead of embedding the content
            in your generated HTML.

            As you can see, this comment starts with `-`, which will tells the comment
            to strip all white spaces before it, until it finds the first non-white space
            character, a `>`.

            The comment is also terminated with `~`. This also strips white spaces, but
            will leave one space, or a newline character, if the stripped content contained
            a newline.
        ~#}
        <style>
        /*<![CDATA[*/
            {%~ include "_layout.css" ~%}
        /*]]>*/
        </style>
    </head>
    <body>
        {%~ block content %}{% endblock ~%}
    </body>
</html>

{%- macro lang_select(page, query="") -%}
    <ul id="lang-select">
        {%- if lang != Lang::en -%}
            <li><a href="/en/{{ page }}.html{{ query }}">This page in English</a></li>
        {%- endif -%}
        {%- if lang != Lang::de -%}
            <li><a href="/de/{{ page }}.html{{ query }}">Diese Seite auf deutsch.</a></li>
        {%- endif -%}
        {%- if lang != Lang::fr -%}
            <li><a href="/fr/{{ page }}.html{{ query }}">Cette page est en français.</a></li>
        {%- endif -%}
    </ul>
{%- endmacro lang_select -%}
